<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
    <title>日新网 - 我的商讯</title>
    <link rel="stylesheet" href="__TMPL__Public/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/style.css">
    <script type="text/javascript" src="__TMPL__Public/assets/js/rem.js"></script>
    <style>
        .tab_nav li {
            width: 33%!important;
            text-align: center;
        }
        body {
            background-color: #fff!important;
        }
    </style>
</head>
<body>
<!--nav-->
<tc_include file="Public:nav"/>
<!--我的问答页-->
<div class="tab_nav " id="tab_nav">
    <php>
        $pass       = isset($status_counts['1']) ? $status_counts['1'] : 0;
        $draft      = isset($status_counts['4']) ? $status_counts['4'] : 0;
        $no_pass    = isset($status_counts['2']) ? $status_counts['2'] : 0;
    </php>
    <ul class="comWidth clearfix status_ul">
        <li data-type="1" class="{$status == 1 ? 'active' : ''}">已发布(<span>{$pass}</span>)</li>
        <li data-type="4" class="{$status == 4 ? 'active' : ''}">草稿(<span>{$draft}</span>)</li>
        <li data-type="2" class="{$status == 2 ? 'active' : ''}">未通过(<span>{$no_pass}</span>)</li>
    </ul>
</div>
<div id="tab_content">
    <div class="tab_content comWidth index_content">
        <volist name="lists" id="vo">
            <div class="questions_item ">
                <a href="{:U('Portal/Businessnews/news_detail', ['id' => $vo['id']])}">
                    <p class="text1 ellipsis2">{$vo.post_title}</p>
                </a>
                <p class="text2">
                    <span>{:time_format($vo['post_date'])}</span>
                </p>
            </div>
        </volist>
        <if condition="empty($lists)">
            <div style="width: 5rem;height: 3.8rem;position: absolute;top: 50%;left: 50%;margin-top: -1.9rem;margin-left: -2.5rem;">
                <img src="/public/images/img/replace.png" alt="" style="width: 100%;height: auto;">
            </div>
        </if>
    </div>

    <div style="height: .5rem;line-height: .5rem;background-color: #efdddd;" class="js-infinite-scroll-loading text-center">更多</div>
    <div id="nextpage"></div>
</div>

<!--页脚-->
<tc_include file="Public:footer"/>

<script type="text/javascript" src="__TMPL__Public/assets/js/jquery.1.12.4.js"></script>
<script src="__TMPL__Public/assets/js/bootstrap.min.js" ></script>
<script src="__TMPL__Public/assets/js/jquery.infiniteScroll.js"></script>
<script>
    // 加载更多
    $('#nextpage').infiniteScroll({
        loading:'.js-infinite-scroll-loading',
        total_pages:{$total_pages},
        success:function(content){
            var items = $(content).find('.index_content .questions_item');
            if(items.length > 0){
                $('.index_content').append(items);
            }
        }
    });

    $(".status_ul li").click(function () {
        var type = $(this).attr('data-type');
        window.location.href = "{:U('Portal/Businessnews/user_business_news')}" + "&status=" + type;
    });
</script>

</body>
</html>